﻿@model PagedList<Orange.Mvc4App.Models.Customer>
@{
    int seq = (Model.PageIndex - 1) * Model.PageSize;
}
@if (Model != null && Model.PageCount > 0) {
    <table class="list">
        <tr>
            <th style="width: 80px;">
                序号
            </th>
            <th>
                公司名称
            </th>
            <th>
                简称
            </th>
            <th>
                助记码
            </th>
            <th>
                联系电话
            </th>
            <th>
                联系人
            </th>
            <th>
                操作
            </th>
        </tr>
        @foreach (var item in Model) {
            <tr>
                <td>
                    @((++seq).ToString())
                </td>
                <td>
                    @Html.ActionLink(item.CustomerName, "Details", new { id = @item.CustomerId })
                </td>
                <td>
                    @item.ShortName
                </td>
                <td>
                    @item.MnCode
                </td>
                <td>
                    @item.Phones
                </td>
                <td>
                    @item.Contract
                </td>
                <td>
                    @Html.ImageLink(Url.Action("Edit", new { id = item.CustomerId }), Url.Content("~/Content/images/icon-edit.gif"))
                    @if (item.Status != "D") { 
                        @Ajax.ImageLink(null, new AjaxOptions {
                       Confirm = "确认删除吗?",
                       HttpMethod = "Post",
                       OnFailure="ActionErr",
                       InsertionMode = InsertionMode.Replace,
                       UpdateTargetId = "list",
                   }, Url.Action("Delete", new { id = item.CustomerId, pageIndex = Model.PageIndex }), Url.Content("~/Content/images/icon_del.gif"))
                    }
                </td>
            </tr>
        }
    </table>
    <nav class="center">
        @Html.PageLinks(Model.PageCount, Model.PageIndex, i => Url.Action("Index", new { pageIndex = i }))
    </nav>
}
@*else
{
    @:温馨提示: 没有数据哦
}
*@